<!-- 农机租凭和场地租凭or作物烘干和作物收购和直播带货 -->
<template>
	<view>
		<uni-nav-bar title="填写订单" @clickLeft="back" left-icon="left" backgroundColor="#fff" color="#000"
			statusBar="true" />
		<!-- 农机租凭和场地租凭 -->
		<!-- <machineryOrAarable :showFlag="machineryOrAarableFlag" /> -->
		<!-- 作物烘干和作物收购和直播带货 -->
		<breeding 
			:breedingFlag="breedingFlag"
			:dryingFlag="dryingFlag"
			:purchaseFlag="purchaseFlag"
			:livestreamMarketingFlag="livestreamMarketingFlag"
			:anchorName="anchorName"
			:product="product"
			:anchorPrice="anchorPrice"
			:anchorId="anchorId"
			:endTime="endTime"
			:MaintenanceFlag="MaintenanceFlag"
			:sealingFlag="sealingFlag"
			:liveTimeBegin1="liveTimeBegin"
			:liveTimeEnd1="liveTimeEnd"
			:landLeaseFlag="landLeaseFlag"
			:tillingLandFlag="tillingLandFlag"
			:machineryFlag="machineryFlag"
			:relateDevice="relateDevice"
			:relateDeviceName="relateDeviceName"
			:svcObjIds="svcObjIds"
			:arableFlag="arableFlag"
			:expectPrice="expectPrice"
			:day="day"
		/>
	</view>
</template>

<script>
	import machineryOrAarable from './components/machineryOrAarable.vue'
	import breeding from './components/breeding.vue'
	export default {
		data() {
			return {
				machineryOrAarableFlag: false,
				breedingFlag: false,
				dryingFlag: false,
				sealingFlag:false,//农机封存
				MaintenanceFlag:false,//维保服务
				purchaseFlag: false,
				livestreamMarketingFlag: false,
				anchorName: '',
				product: '',
				anchorPrice: null,
				anchorId: null,
				liveTimeBegin: '',
				liveTimeEnd: '',
				endTime: '',
				landLeaseFlag: false,
				tillingLandFlag: false,
				machineryFlag: false,
				arableFlag: false,
				relateDevice: '',
				relateDeviceName: '',
				svcObjIds: null,
				expectPrice: null,
				day: null
			}
		},
		components: {
			machineryOrAarable,//农机租凭和场地租凭
			breeding
		},
		onLoad(e) {
			this.svcObjIds = e.svcObjId
			this.relateDevice = e.id
			this.relateDeviceName = e.name
			this.anchorPrice = e.anchorPrice*1
			this.anchorName = e.anchorName
			this.anchorId = e.anchorId
			this.liveTimeBegin = e.liveTimeBegin
			this.liveTimeEnd = e.liveTimeEnd
			this.product = e.product
			this.endTime = e.endTime
			this.expectPrice = e.expectPrice * 1
			this.day = e.day * 1
			let serviceTypeName1 = uni.getStorageSync('serviceTypeName1')
			if(serviceTypeName1 === '农机租赁') {
				this.machineryOrAarableFlag = true
				this.machineryFlag = true
			} else if(serviceTypeName1 === '育秧') {
				this.breedingFlag = true
			} else if(serviceTypeName1 === '农产品加工') {
				this.dryingFlag = true
			} else if(serviceTypeName1 === '农产品收购') {
				this.purchaseFlag = true
			} else if(serviceTypeName1 === '带货服务') {
				this.livestreamMarketingFlag = true
			} else if(serviceTypeName1 === '土地租赁') {
				this.landLeaseFlag = true
			} else if(serviceTypeName1 === '翻耕整地' || serviceTypeName1 === '机插秧' || serviceTypeName1 === '无人机打药' || serviceTypeName1 === '作物播种' || serviceTypeName1 === '作物收割' || serviceTypeName1 === '秸秆离田') {
				this.tillingLandFlag = true
			} else if(serviceTypeName1 === '设施租赁') {
				this.arableFlag = true
			}else if(serviceTypeName1 === '维保服务') {
				this.MaintenanceFlag = true
			}else if(serviceTypeName1 === '封存服务') {
				this.sealingFlag = true
			}
		},

		methods: {
			back() {
				let url = ''
				// 农机租凭or场地租凭
				if(this.machineryFlag || this.arableFlag) {
					url = '/subPage1/socialized-service/farm-service/user/rentMachineryOrArable/selectMachineryOrAarable'
				}
				// 育秧
				if(this.breedingFlag || this.dryingFlag || this.purchaseFlag || this.landLeaseFlag || this.tillingLandFlag || this.MaintenanceFlag ||this.sealingFlag) {
					url = '/subPage1/socialized-service/farm-service/normalUser/serviceSelect/service-organization/service-order'
				}
				if(this.livestreamMarketingFlag ) {
					url = '/subPage1/socialized-service/farm-service/normalUser/serviceSelect/serviceClassify'
				}
				uni.redirectTo({
					url: url
				})
			},
		}
	}
</script>

<style lang="scss" scoped>

</style>